package com.jlf.core.annotation.restful.method;

import org.springframework.core.annotation.AliasFor;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import java.lang.annotation.*;

/**
 * patch请求
 *
 * @author wujr
 * 2022/7/9
 * @version 1.0
 * 【变更历史】
 * [wujr 2022/7/9 1.0 新增]
 */
@Target(ElementType.METHOD)
@Retention(RetentionPolicy.RUNTIME)
@Documented
@RestfulApi(method = RequestMethod.PATCH)
public @interface RestfulPatch {
    @AliasFor(annotation = RestfulApi.class)
    String name();
    @AliasFor(annotation = RestfulApi.class)
    String code() default "";
    @AliasFor(annotation = RestfulApi.class)
    String id() default "";
    @AliasFor(annotation = RestfulApi.class)
    String remark() default "";
    /**
     * 是否进行合并
     * name+ApiController.domainName
     * code+ApiController.domainCode
     * @return true表示需要合并称为一个完整的名称和编码
     */
    @AliasFor(annotation = RestfulApi.class)
    boolean merge() default true;

    /**
     * 是否忽略扫描
     * @return true表示该接口需要被忽略扫描
     */
    @AliasFor(annotation = RestfulApi.class)
    boolean ignoreScan() default false;

    /**
     * 接口是否允许匿名访问
     * true——允许
     * false——禁止
     * @return 是否允许匿名
     */
    @AliasFor(annotation = RestfulApi.class)
    boolean anonymous() default false;
    /**
     * 接口是否需要授权访问
     * true——需要
     * false——不需要
     * @return 是否需要授权
     */
    @AliasFor(annotation = RestfulApi.class)
    boolean authorize() default true;

    /**
     * Alias for {@link RequestMapping#path}.
     * @return 接口路径
     */
    @AliasFor(annotation = RequestMapping.class)
    String[] path() default {};

    /**
     * Alias for {@link RequestMapping#params}.
     * @return 定制参数
     */
    @AliasFor(annotation = RequestMapping.class)
    String[] params() default {};

    /**
     * Alias for {@link RequestMapping#headers}.
     * @return 定制头部
     */
    @AliasFor(annotation = RequestMapping.class)
    String[] headers() default {};

    /**
     * Alias for {@link RequestMapping#consumes}.
     * @return 消费者
     */
    @AliasFor(annotation = RequestMapping.class)
    String[] consumes() default {};

    /**
     * Alias for {@link RequestMapping#produces}.
     * @return 生产者
     */
    @AliasFor(annotation = RequestMapping.class)
    String[] produces() default {};

    /**
     * 该接口适用的角色列表
     * @return 角色列表，参考ActorProfile.roleType
     */
    @AliasFor(annotation = RestfulApi.class)
    int[] roleType() default {};
}
